package liquidfs.data;

import com.thoughtworks.xstream.annotations.*;

@XStreamAlias("link")
public class Link implements Comparable<Link> {
	
   private PeerDevice device;
	private Host host;
	
	public Link (PeerDevice device, Host host) {
		this.device = device;
		this.host = host;
	}
	
	public Host getHost() {
		return host;
	}
	
	public void setHost(Host host) {
		this.host = host;
	}

	public PeerDevice getDevice() {
		return device;
	}

	public void setDevice(PeerDevice device) {
		this.device = device;
	}
	
	@Override
	public String toString () {
	   return this.device.getName() + "(" + this.host.toString() + ")";
	}

   @Override
   public int compareTo(Link o) {
      return this.toString().compareTo(o.toString());
   }
}
